﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Person;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Diagrams.Extensions.ViewModels;
using System.Windows.Media;

namespace Broker.View.PersonView
{
    public class PersonGraphicViewModel : NodeViewModelBase
    {
        private IPerson person;

        public PersonGraphicViewModel(IPerson person):base()
        {
            this.person = person;
        }

        public string Name
        {
            get
            {
                return person.Name;
            }
            
        }

        public string Age
        {
            get
            {
                return person.Age + " 岁";
            }
        }

        public string Phone
        {
            get
            {
                if (!string.IsNullOrEmpty(person.Mobile))
                {
                    return person.Mobile;
                }else if(!string.IsNullOrEmpty(person.HomePhone))
                {
                    return person.HomePhone;
                }
                else if (!string.IsNullOrEmpty(person.WorkPhone))
                {
                    return person.WorkPhone;
                }

                return string.Empty;
            }
        }

        public byte[] Photo
        {
            get
            {
                return person.Photo;
            }

        }

        public Brush Background {get;set;}

    }
}
